﻿@Html.DevExpress().FileManager(
    settings =>
    {
        settings.Name = "fileManager";
        settings.Height = 500;
        settings.Width = Unit.Percentage(100);
        settings.CallbackRouteValues = new { Controller = "Report", Action = "FileManagePartial" };
        settings.DownloadRouteValues = new { Controller = "Report", Action = "DownloadFiles" };

        //settings.Settings.ThumbnailFolder = Url.Content("~/Content/FileManager/Thumbnails");
        settings.Settings.AllowedFileExtensions = new string[] {".xls", ".xlsx", ".csv"};
        //settings.Settings.InitialFolder = SpreadSheetViewer.Helper.DirectoryManagmentUtils.DocumentBrowsingFolderPath;
        //settings.Settings.InitialFolder = "XLSX";

        settings.SettingsEditing.Assign(new FileManagerSettingsEditing(null)
        {
            AllowCreate = true,
            AllowMove = true,
            AllowDelete = true,
            AllowRename = true,
            AllowCopy = true,
            AllowDownload = true
        });
        settings.SettingsToolbar.Assign(new FileManagerSettingsToolbar(null)
        {
            ShowPath = true,
            ShowFilterBox = true
        });
        settings.SettingsFolders.Assign(new FileManagerSettingsFolders(null)
        {
            Visible = true,
            EnableCallBacks = false,
            ShowFolderIcons = true,
            ShowLockedFolderIcons = true
        });
        settings.SettingsFileList.Assign(new FileManagerSettingsFileList(null)
        {
            ShowFolders = true,
            ShowParentFolder = true
        });
        settings.SettingsBreadcrumbs.Assign(new FileManagerSettingsBreadcrumbs(null)
        {
            Visible = true,
            ShowParentFolderButton = true,
            Position = BreadcrumbsPosition.Top
        });
        var settingsUpload = new MVCxFileManagerSettingsUpload();
        settingsUpload.Enabled = true;
        settingsUpload.AdvancedModeSettings.EnableMultiSelect = true;
        settings.SettingsUpload.Assign(settingsUpload);
        settings.SettingsUpload.UseAdvancedUploadMode = true;
        settings.SettingsAdaptivity.Enabled = true;

        //settings.SettingsPermissions.AccessRules.Add(new FileManagerFolderAccessRule { Path = "System", Edit = Rights.Deny });

        settings.SettingsAdaptivity.Enabled = true;

        settings.FileUploading = (s, e) =>{e.Cancel = false; /*e.ErrorText = Utils.GetReadOnlyMessageText();*/};
        settings.FolderCreating = (s, e) => { e.Cancel = false; };
        settings.ItemRenaming = (s, e) => { e.Cancel = false; };
        settings.ItemDeleting = (s, e) => { e.Cancel = false; };
        settings.ItemMoving = (s, e) => { e.Cancel = false; };
        settings.ItemCopying = (s, e) => { e.Cancel = false; };
    }
).BindToFolder(SpreadSheetViewer.Helper.DirectoryManagmentUtils.DocumentBrowsingFolderPath).GetHtml()